RegWriteExpandStringValue

Prototype:

function RegWriteExpandStringValue(const RootKey: Integer; const SubKeyName, ValueName, Data: String): Boolean;

Description:

Writes the specified REG_EXPAND_SZ-type registry value. Returns True if successful, False otherwise.

Example:
begin
  RegWriteStringValue(HKEY_CURRENT_USER, 'Software\My Company\My Program',
    'UserName', '%UserName%);
end;